package com.lagou.spi;

import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;
import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;

import java.util.Properties;

public class MyIdGenerator implements ShardingKeyGenerator {
	private SnowflakeShardingKeyGenerator snowflakeShardingKeyGenerator = new SnowflakeShardingKeyGenerator();

	@Override
	public Comparable<?> generateKey() {
		System.out.println("自定义id生成");
		return snowflakeShardingKeyGenerator.generateKey();
	}

	@Override
	public String getType() {
		return "my_key_generator";
	}

	@Override
	public Properties getProperties() {
		return null;
	}

	@Override
	public void setProperties(Properties properties) {

	}
}
